import axios from 'axios';
import { TOKEN_KEY } from './constants';

export const apiReq = axios.create({
  timeout: 60000,
});

apiReq.interceptors.request.use((config) => {
  const bearerToken = `Bearer ${localStorage.getItem(TOKEN_KEY)}`;
  console.log('bearToken:' + bearerToken);
  config.headers.Authorization = bearerToken;
  return config;
});

apiReq.interceptors.response.use((config) => {
  console.log('after response...');
  return config;
});
